package com.bosssoft.trainee.nontax.util.mapper.dtoVo;

import com.bosssoft.trainee.nontax.entity.dto.UserDto;
import com.bosssoft.trainee.nontax.entity.vo.UserVo;
import com.bosssoft.trainee.nontax.util.UserSexToStringFormat;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @Description: user  dto vo transform util class
 * @Author: Luo WenLong
 * @Date: 2022/6/25 9:02
 */
@Mapper(componentModel = "spring",uses = {UserSexToStringFormat.class})
public interface UserDtoVo {
    /**
     * @Description: dto to vo
     * @param userDto user
     * @return: com.bosssoft.trainee.nontax.entity.vo.UserVo
     * @Author: Luo WenLong
     * @Date: 2022/6/25 9:11
     */
    @Mappings({
            @Mapping(source = "birth", target = "birth", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(source = "createTime", target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(source = "sex",target = "sex")
    })
    UserVo dto2vo(UserDto userDto);

    /**
     * @Description: dto to vo
     * @param userDtos user list
     * @return: java.util.List<com.bosssoft.trainee.nontax.entity.vo.UserVo>
     * @Author: Luo WenLong
     * @Date: 2022/6/25 9:11
     */
    List<UserVo> dto2vo(List<UserDto> userDtos);

    /**
     * @Description: vo tp dto
     * @param userVo user
     * @return: com.bosssoft.trainee.nontax.entity.dto.UserDto
     * @Author: Luo WenLong
     * @Date: 2022/6/25 9:15
     */
    @Mappings({
            @Mapping(source = "birth", target = "birth", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(source = "createTime", target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(source = "sex",target = "sex")
    })
    UserDto vo2dto(UserVo userVo);

    /**
     * @Description: vo tp dto
     * @param userVos user list
     * @return: java.util.List<com.bosssoft.trainee.nontax.entity.dto.UserDto>
     * @Author: Luo WenLong
     * @Date: 2022/6/25 9:15
     */
    List<UserDto> vo2dto(List<UserVo> userVos);
}

